﻿using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using KC.Framework.Tenant;
using KC.DTO.Account;
using KC.DTO.Core;

namespace KC.Service.Account
{
    public interface IPermissionService
    {
        bool CreatePermission(PermissionDTO model, string operatorId, string operatorName);
        bool DeletePermission(int id, string operatorId, string operatorName);
        bool ExistsPermission(Guid appId, string controllerName, string actionName);
        List<PermissionSimpleDTO> GetAllPermissions();
        Task<List<PermissionSimpleDTO>> GetAllSimplePermissionTreesAsync();

        Task<List<PermissionSimpleDTO>> GetRootPermissionsByNameAsync(string name);
        PaginatedBaseDTO<PermissionDTO> GetPaginatedPermissions(string key, string value, int pageIndex, int pageSize, string sidx, bool isAscent);

        PermissionDTO GetPermissionByAppIDAndName(Guid? appId, string controllerName, string actionName);
        PermissionDTO GetDetailPermissionById(int id);
        List<PermissionDTO> GetPermissionsByRoleIds(List<string> roleIds);
        List<PermissionDTO> GetPermissionsByRoleNames(List<string> roleNames);
        Task<bool> SavePermissionsAsync(List<PermissionDTO> models, Guid appId);
        bool UpdatePermission(PermissionDTO model, string operatorId, string operatorName);
        bool UpdateRoleInPermission(int id, List<string> addList, string operatorId, string operatorName);
    }
}